package cn.bx.film.service;

import cn.bx.film.dao.FilmInfoDao;
import cn.bx.film.entity.FilmInfo;
import cn.bx.film.entity.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.Date;
import java.util.List;

//M V C
@Scope("prototype")
@Transactional(readOnly = true)
@Service
public class FilmInfoService {

    @Autowired
    private FilmInfoDao filmInfoDao;

    @Transactional(readOnly = false)
    public int add(FilmInfo u) {
        return filmInfoDao.add(u);
    }

    //查询所有
    public Page<FilmInfo> search(String filmName,String actor,String director) {
        List<FilmInfo> filmInfos = filmInfoDao.search(filmName,actor,director);
        Page<FilmInfo> f=new Page<>(filmInfos);
        return f;
    }

}
